<template >
    <div class='aaa'>

        <el-row>
            <div
                style="width: 27%;height:390px;opacity: 80%;background:white; margin-top:250px;margin-left: 650px;border-radius: 30px">

                <div
                    style="text-align: center;font-size: 40px;line-height:2;color:#303133;font-family:Hiragino Sans GB">
                    生鲜市场
                </div>

                <el-divider><i class="el-icon-s-shop"></i></el-divider>

                <el-form :model="formData" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic"
                    style="position: absolute;left:710px;top:380px;float:left;">
                    <el-form-item prop="name" label="姓名" style="margin-top: 10px" :rules="[
                    { required: true, message: '姓名不能为空', trigger: 'blur' },
                    ]">
                        <el-input v-model="formData.name"></el-input>
                    </el-form-item>
                    <el-form-item prop="account" label="账号" style="margin-top: 10px" :rules="[
                    { required: true, message: '账号不能为空', trigger: 'blur' },
                    ]">
                        <el-input v-model="formData.account"></el-input>
                    </el-form-item>
                    <el-form-item prop="password" label="密  码"
                        :rules="{ required: true, message: '密码不能为空', trigger: 'blur' }">
                        <el-input type="password" v-model="formData.password"></el-input>
                    </el-form-item>
                    <el-form-item style="margin-top: 30px">
                        <el-button type="primary" @click="register()">注册</el-button>
                        &nbsp;
                        <el-button type="info" @click="$router.push('/login')" >返回</el-button>

                    </el-form-item>
                </el-form>


            </div>


        </el-row>


    </div>

</template>

<script>


export default {
    data(){
        return{
            formData:{},

        }
    }, 
    methods: {
        //登录
        register(){
            this.$axios.post("/user/register",this.formData).then(respData =>{
                if(respData.data.data){
                    this.$message({
                        message: '注册成功！',
                        type: "success"
                    })

                    this.$router.push('/login')
                }
            })
        }
    }
    
}
</script>

<style scoped>
  .aaa{
  
    height: 1200px;
    background-image: url('../assets/images/registerimg.jpg');
    background-size: cover;
    background-repeat: no-repeat;
  }

 
</style>
